package com.huixue.server.rule;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.huixue.server.basic.Common;

public class Demo {
	private static SqlSessionFactory factory = Common.getSqlSessionFactory();

	public static void main(String[] args) {
		SqlSession session = factory.openSession();
		System.out.println(">>>>>>>>>>");
		JSONObject requestData = new JSONObject();
		JSONObject JSONObj = null;
		JSONArray JSONArray = new JSONArray();
		try {
			/*
			requestData.put("contract_numer", "a883eca8e60e4bd9b48f40e318e2481a");
			requestData.put("customer_name", "蛛丝马迹");
			requestData.put("contract_expires", "12M");
			requestData.put("contract_limit", "16");
			requestData.put("contract_status", "0");
			requestData.put("remain_amount", "16");
			requestData.put("onset_time", "2012-10-23 15:21");
			new Rule1115().doIt(session, requestData.toString());
			*/
			
			//-----------------------------------------------------------
//			/*
//			for (int i = 0; i < 10; i++) {
				JSONObj = new JSONObject();
				JSONObj.put("borrow_number", Common.getUUID());
				JSONObj.put("borrow_name", "刘岩");
				JSONObj.put("store_number", "a883eca8e60e4bd9b48f40e318e2481a");
				JSONObj.put("store_name", "蛛丝马迹");
				JSONObj.put("assign_limit", "2");
				JSONObj.put("assign_expires", "12M");
				JSONObj.put("onset_time", "2012-10-23 15:21");
				JSONArray.put(JSONObj);
//			}
			requestData.put("list", JSONArray);
			new Rule1116().doIt(session, requestData.toString());
//			*/
		} catch (JSONException e) {
			e.printStackTrace();
		}

	}
}
